class Student():
    def __init__(self):
        print("调用了init方法")
        pass
    def __new__(cls, *args, **kwargs):
        print("调用了new方法")
        return object.__new__(cls)
xm=Student()
xh=Student()
print(id(xm))
print(id(xh))
# 单例模式
class Person():
    # 创建变量保存对象
    __instance=None
    def __new__(cls, *args, **kwargs):
        if cls.__instance is None:
            cls.__instance=object.__new__(cls)
            return cls.__instance
        else:
            return cls.__instance
        pass
print("单例模式")
zs=Person()
tom=Person()
print(id(zs))
print(id(tom))